package com.objects.demo02;

public class MyTime {

    private int year;
    private int month;
    private int day;

    public MyTime() {
    }

    public MyTime(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null || !(obj instanceof Object)) {
            return false;
        }
        if (this  == obj) {
            return true;
        }
        // 类型转换
        MyTime t = (MyTime) obj;
        return this.year == t.year && this.month ==  t.month && this.day ==t.day;
    }
}
